//
//  JTBSeeCtrlView.m
//  JTB
//
//  Created by 吴文拼 on 2017/12/27.
//  Copyright © 2017年 吴文拼. All rights reserved.
//

#import "DCFSeeCtrlView.h"

@implementation DCFSeeCtrlView

-(instancetype)initWithSecurityBlock:(SecurityClickBlock)block{
    if (self = [super init]) {
        _isSecurity = YES;
        [self set_dcf_image:[UIImage imageNamed:@"nosee_img"]];
        _securityBlock = block;
        self.userInteractionEnabled = YES;
        [self set_dcf_EnlargeEdgeWithTop:20 right:20 bottom:20 left:20];
        [self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(securityClick)]];
    }
    return self;
}

-(void)securityClick{
    _isSecurity = !_isSecurity;
    [self set_dcf_image:_isSecurity?[UIImage imageNamed:@"nosee_img"]:[UIImage imageNamed:@"see_img"]];
    _securityBlock(_isSecurity);
}

@end
